/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package dao;

import java.util.Collection;
import util.IdbUtil;


/**
 *
 * @author duonghung1369
 */
public abstract class BaseDAO<T> {
    protected IdbUtil _database;

    public BaseDAO()
    {

    }

    public BaseDAO(IdbUtil database)
    {
      _database = database;
    }
    public abstract Collection<T> getAll() throws Exception;
    /**
     * <summary>Get the T with given identifier</summary>
     * @param id
     * @return T
     */
    public abstract T get(int id) throws Exception;

    /**
     * <summary>Create new entity T<summary>
     * @param id
     * @return T
     */
    public abstract T create(T entity) throws Exception;

    /**
     * <summary>Update existed entity</summary>
     * <exception>util.exception.RecordNotFoundException</exception>
     * @param entity
     */
    public abstract void update(T entity) throws Exception;

    /**
     * <summary>Delete existed entity</summary>
     * <exception>util.exception.RecordNotFoundException</exception>
     * @param entity
     */
    public abstract boolean delete(int id) throws Exception;
    
}
